package com.bdsy.system.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.system.dao.AuthorizationMapper;
import com.bdsy.system.model.Authorization;
import com.bdsy.system.service.AuthorizationService;
import com.bdsy.system.service.UserService;

/**
 * ClassName:UserServiceImpl
 * Description: TODO 添加描述.
 * @author   Administrator
 * @version  
 * @since    JDK 1.8
 */

@Service("authorizationService")
public class AuthorizationServiceImpl implements AuthorizationService{

    @Autowired
    AuthorizationMapper authorizationMapper;
    
    @Override
	public List<Authorization> getAuthList() {
		List<Authorization> authorizations = authorizationMapper.selectAuthList();
		return authorizations;
	}
    
	@Override
	public List<Authorization> getAuthorization() {
		List<Authorization> authorizations = authorizationMapper.selectAuthorization();
		return authorizations;
	}
	
	@Override
	public List<Authorization> queryMenu(String id) {
		List<Authorization> authorizations = authorizationMapper.queryMenu(id);
		return authorizations;
	}
	
	@Override
	public List<Authorization> getCheckedAuthByRole(String roleId) {
		List<Authorization> authorizations = authorizationMapper.selectCheckedAuthByRole(roleId);
		return authorizations;
	}
	
	@Override
	public List<Map> getAuth() {
		List<Map> authorizations = authorizationMapper.selectAuth();
		return authorizations;
	}
	
	@Override
	public List<Map> getAuthParnet() {
		List<Map> authorizations = authorizationMapper.selectAuthParnet();
		return authorizations;
	}
	
	@Override
	public boolean addAuth(Authorization authorization){
		int result = authorizationMapper.insert(authorization);
		return result > 0 ? true : false;
	}
	
	@Override
	public boolean updateAuth(Authorization authorization){
		int result = authorizationMapper.updateByPrimaryKeySelective(authorization);
		return result > 0 ? true : false;
	}
	
	@Override
	public boolean deleteAuthById(List<String> pIds){
		int result = authorizationMapper.deleteAuth(pIds);
		return result > 0 ? true : false;
	}
	
}

